/*
 * Singularity Engine
 * Copyright (C) 2010 Vyacheslav Vorobyov, All rights reserved.
 * See LICENSE for full license information.
 */
package org.singularity.lang.model;

/**
 * @author vjache
 *
 */
public class Variable implements Evaluatable {
	
	public static interface Binder
	{
		Constant bind(Variable aVar);
	}

	private final String _name;
	private final Binder _binder;

	/**
	 * 
	 */
	public Variable(String aVarName,Binder aBinder) {
		_name = aVarName;
		_binder = aBinder;
	}

	/* (non-Javadoc)
	 * @see org.singularity.lang.model.Evaluatable#evaluate()
	 */
	@Override
	public Evaluatable evaluate() 
	{return _binder.bind(this);}

	/**
	 * @return the name
	 */
	public String getName() 
	{return _name;}

	/**
	 * @return the binder
	 */
	public Binder getBinder() 
	{return _binder;}

	@Override
	public String toString() {
		return String.valueOf(_name);
	}
}
